package com.study.thread;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SyncStaticThread extends Thread{

    Logger logger = LoggerFactory.getLogger(SyncStaticThread.class);

    @Override
    public void run() {
        SyncStaticThread.test1();
    }

    public synchronized static void test1(){
        try {
            System.out.println(Thread.currentThread().getName() + "run 进入了同步块");
            Thread.sleep(1000);
            System.out.println(Thread.currentThread().getName() + "run 休眠结束");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
